package com.ljz.controller.pc;


import com.ljz.common.core.controller.MyBaseController;
import com.ljz.common.utils.ReturnResult;
import com.ljz.entity.ShopDetail;
import com.ljz.service.ShopDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/api/pc")
@Api(tags = "店铺管理")
public class ShopDetailPcController extends MyBaseController {

    @Autowired
    ShopDetailService shopDetailService;

    @ApiOperation("添加商家")
    @PostMapping("/shop")
    public ReturnResult saveShop(@RequestBody ShopDetail shopDetail) {

        int res = shopDetailService.saveEntity(shopDetail);
        return saveResult(res);

    }

    @ApiOperation("根据id查找商家信息")
    @GetMapping("/shop")
    public ReturnResult getShop(Long id) {

        Map shopDetail = shopDetailService.findShopDetailByShopId(id);
        return success("商家信息",shopDetail);
    }
}
